Expand description
rs-tiled
tiled = "0.10.3"
A crate for reading TMX (map) and TSX (tileset) files from the Tiled Map Editor into Rust. It provides a huge set of features as well as a strong wrapper over internal features such as GIDs.
Documentation is available on docs.rs.
Code contributions are welcome as are bug reports, documentation, suggestions and criticism.
The minimum supported TMX version is 0.13.
Example
use tiled::Loader;
fn main() {
let mut loader = Loader::new();
let map = loader.load_tmx_map("assets/tiled_base64_zlib.tmx").unwrap();
println!("{:?}", map);
println!("{:?}", map.tilesets()[0].get_tile(0).unwrap().probability);
let tileset = loader.load_tsx_tileset("assets/tilesheet.tsx").unwrap();
assert_eq!(*map.tilesets()[0], tileset);
}
Licences
assets/tilesheet.png by Buch
Licenced under MIT
Structs
Part of an infinite tile layer’s data.
Part of an
InfiniteTileLayer
.
This is the only map-wrapped type that has a Wrapper
suffix. This will change in a later version.Represents a RGBA color with 8-bit depth on each channel.
A cache that identifies resources by their path in the user’s filesystem.
A
TileLayer
with a defined bound (width and height).The raw data of a
FiniteTileLayer
. Does not include a reference to its parent Map
.A structure describing a frame of a TMX tile animation.
A group layer, used to organize the layers of the map in a hierarchy.
Also see the TMX docs.
The raw data of a
GroupLayer
. Does not include a reference to its parent Map
.A reference to an image stored somewhere within the filesystem.
A layer consisting of a single image.
Also see the TMX docs.
The raw data of an
ImageLayer
. Does not include a reference to its parent Map
.The raw data of a
InfiniteTileLayer
. Does not include a reference to its parent Map
.A generic map layer, accessed via
Map::layers()
.Stores the internal tile gid about a layer tile, along with how it is flipped.
All Tiled map files will be parsed into this. Holds all the layers and tilesets.
Wrapper over an
ObjectData
that contains both a reference to the data as well as
to the map it is contained in.Raw data belonging to an object. Used internally and for tile collisions.
Also called an “object group”. Used for storing
Object
s in a map.Raw data referring to a map object layer or tile collision data.
Points to a tile belonging to a tileset.
Raw data belonging to a tile.
A collection of tiles for usage in maps and template objects.
Stores the data of the Wang color.
The Wang ID, stored as an array of 8 u8 values.
Raw data belonging to a WangSet.
Stores the Wang ID.
Enums
Errors which occured when parsing the file
Represents some kind of map layer.
A structure describing an
Object
’s shape.Represents the way tiles are laid out in a map.
Represents a custom property’s value.
A map layer containing tiles in some way. May be finite or infinite.
Wang set’s terrain brush connection type.
Traits
A trait identifying a data type that holds resources (such as tilesets) and maps them to a
ResourcePath
to prevent loading them more than once. Normally you don’t need to use this
type yourself unless you want to create a custom caching solution to, for instance, integrate
with your own.
If you simply want to load a map or tileset, use the Loader
type.Type Definitions
A custom property container.
A reference type that is used to refer to a resource. For the owned variant, see
ResourcePathBuf
.An owned type that is used to refer to a resource. For the non-owned variant, see
ResourcePath
.A result with an error variant of
crate::Error
.A tile ID, local to a tileset.